var Products = {
	'001' : {
		'productCode' : "001",
		'name' : "Lavender heart",
		'price' : 9.25
	},
	'002' : {
		'productCode' : "002",
		'name' : "Personalised cufflinks",
		'price' : 45
	},
	'003' : {
		'productCode' : "003",
		'name' : "Kids T-shirt",
		'price' : 19.95
	}

};

var run1 = [ "001", "002", "003" ];
var run2 = [ "001", "003", "001" ];
var run3 = [ "001", "002", "001", "003" ];

var Runner = {

	rules : [ new DiscountRule1(), new DiscountRule2() ],

	run : function(items) {

		document.write("Running...<br/>");
		document.write("<br/>");

		var checkout = new Checkout(this.rules);

		for ( var i = 0, item; i < items.length; ++i) {
			item = items[i];
			document.write("Item Scanned: " + Products[item]['name']);
			document.write("<br/>");
			checkout.scan(new Item(Products[item]['productCode'],
					Products[item]['name'], Products[item]['price']));
		}
		document.write("<br/>");
		document.write("Total: " + checkout.total());
		document.write("<br/><br/><br/><br/>");
	}

};

Runner.run(run1);
Runner.run(run2);
Runner.run(run3);